package edu.bupt.threadpool;

import java.util.Random;
import java.util.concurrent.BlockingQueue;

public class LoadPapersHandler implements Runnable {
	
	private static BlockingQueue<String> bQueue;
	private static int index = 0;
	public LoadPapersHandler(BlockingQueue<String> bQueue){
		this.bQueue = bQueue;
	}

	@Override
	public void run() {
			for(int i = 0 ; i < 10;i++){
				try {
					bQueue.put("你是笨蛋，我是好人"+index);
					System.out.println("加入队列：" + index + " "+ getClass());
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				index++;
			}
			try {
				Thread.sleep(new Random().nextInt(400)+100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}	
	}

}
